package com.design.prototype;

/**
 * @Author: ChengLei.Liu
 * @Date: 2020-06-09 14:25
 * @Description: 原型模式
 */
public class PrototypeBean implements Cloneable {

    private String name = "张三";

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public String getName(){
        return this.name;
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        PrototypeBean prototypeBean = new PrototypeBean();
        PrototypeBean clone = (PrototypeBean) prototypeBean.clone();
        System.out.println(prototypeBean.getName());
        System.out.println(clone.getName());
    }

}
